from django.db import models

# Create your models here.
from erp.utils.base_model import BaseModel


class MenuModel(BaseModel):
    """
    功能菜单的模型类
    """
    nuber = models.IntegerField(verbose_name="排序编号", blank=True, null=True)
    url = models.CharField(verbose_name="菜单访问的URL地址", blank=True, null=True, max_length=256)
    name = models.CharField(verbose_name="菜单名称", blank=True, null=True, max_length=50)
    # 不会真正把数据库中的数据删除， 默认是0， 如果是1， 表示删除
    delete_flag = models.CharField(verbose_name="删除的标记", max_length=1, default=0)
    parent = models.ForeignKey("self", blank=True, null=True, related_name="child", on_delete=models.CASCADE)

    class Meta:
        db_table = "t_menu"
        verbose_name = "功能菜单表"
        verbose_name_plural = verbose_name
        app_label = "erp_system"

    def __str__(self):
        return self.name
